<?php
array (
'Example.Translator' =>
array (
'key' => 'Example.Translator',
'exportline' => '@export_end(Example.Translator)',
'comment' => 'function translateGreeting($language){
switch ($language){
case "spanish":return "Hola";
case "german": return "Hallo";
case "english": return "Hello";
case "french": return "Bonjour";
default: return null;
}
}',
),
'Example.TranslatorTester' =>
array (
'key' => 'Example.TranslatorTester',
'exportline' => '@export_end(Example.TranslatorTester)',
'comment' => 'class TranslatorTester extends \\Taeluf\\Tester{
//every function that starts with `test` will be run as a test
public function testTranslateSpanish(){
$actual = translateGreeting(\'spanish\');
$target = "Hola";
echo "Target:{$target}\\nActual:{$actual}";
if ($target==$actual)return true;
}
public function prepare(){
//this code runs BEFORE any of your test code
}
//You can declare other functions that DON\'T start with `test` if you need helper functions.
}
//TranslatorTester::runAll() // just print the results
//TranslatorTester::run([\'testTranslateSpanish\']) // run every test method given in that array
// (new TranslatorTester())->run(); //runs all this way, or pass an array of methods to only run those tests
TranslatorTester::runAllToFile(__FILE__.\'.html\',$alsoPrint=true);
TranslatorTester::xdotoolRefreshFirefox(); // If you have xdotool installed, this will switch to Firefox & refresh focused webpage.',
),
'Example.TranslatorOutput' =>
array (
'key' => 'Example.TranslatorOutput',
'exportline' => '@export_end(Example.TranslatorOutput)',
'comment' => '<details>
<summary><b>TranslateSpanish:</b> <span style="color:green;">success</span> </summary>
<div style=\'padding-left:4ch;white-space:pre;\'>
Target:Hola
Actual:Hola
</div>
</details>',
),
'Extra.RefreshBrowserTab' =>
array (
'key' => 'Extra.RefreshBrowserTab',
'exportline' => '@export(Extra.RefreshBrowserTab)',
'comment' => 'Call `Taeluf\\Tester::xdotoolRefreshFirefox($switchBackToCurrWindow = false)` to refresh your browser tab.
If you\'re writing you\'re using `runAllToFile($file)`, this could come in handy.',
),
'Example.ModifyOutput' =>
array (
'key' => 'Example.ModifyOutput',
'exportline' => '@export_end(Example.ModifyOutput)',
'comment' => 'public function showResult($details){
$successStatement = $details->result ? \'<span style="color:green;">success</span>\' : \'<span style="color:red;">fail</span>\';
if ($details->error!=null)$successStatement = \'<strong style="color:blue;">error</strong>\';
echo "<details>\\n <summary><b>".$details->method.":</b> ".$successStatement." </summary>\\n";
echo " <div style=\'padding-left:4ch;white-space:pre;\'>\\n";
$detailsOutput = htmlentities($details->output);
$detailsLines = explode("\\n",$detailsOutput);
$detailsLines = array_map(function($value){return \' \'.$value;},$detailsLines);
echo implode("\\n",$detailsLines);
// var_dump($detailsLines);
echo "\\n </div>";
if ($details->error!=null){
echo "\\n <br>\\n";
echo " <div style=\'color:red;padding-left:4ch;white-space:pre;\'>\\n";
$errorOutput = $details->error;
$errorLines = explode("\\n",$errorOutput);
$errorLines = array_map(function($value){return \' \'.$value;},$errorLines);
echo implode("\\n",$errorLines);
echo "\\n </div>";
}
echo "\\n</details>\\n";
}',
),
)
?>